import { Progress } from "@wsvaio/utils";
import { createAPI, run } from "@wsvaio/api";

// 创建api对象 泛型添加自定义属性
export const { post, get, put, patch, del, use, extendAPI } = createAPI<{
  success?: string;
  headers: Record<string, string>;
}>({
  baseURL: "/api",
  log: true, // 控制台是否打印日志
  timeout: 0,
  headers: {},
});

use("befores")(async ctx => {
  console.log("befores");
});

use("afters")(async ctx => {
  console.log("afters");
});

use("errors")(async ctx => {
  console.log("errors");
});

use("finals")(async ctx => {
  console.log("finals");
});

export const extendedAPI = extendAPI({
  baseURL: "/ipa",

});

extendedAPI.use("befores")(async ctx => {
  console.log("extendedAPI before");
})


extendedAPI.get("/wdf/:id")()
